package com.ciwong.epaper.modules.me.ui;

import android.view.View;

import com.ciwong.epaper.R;
import com.ciwong.epaper.application.EApplication;
import com.ciwong.epaper.application.EpaperConstant;
import com.ciwong.epaper.modules.cordva.BaseHtmlActicity;
import com.ciwong.epaper.modules.me.util.MeJumpManager;
import com.ciwong.epaper.util.HttpRequest;
import com.ciwong.libs.utils.CWLog;
import com.ciwong.libs.utils.volley.BaseRequest;
import com.ciwong.mobilelib.i.ViewOnClickListener;

/**
 * date :2018/5/24
 * author: lzh
 * description:  我的成积分
 * version:2.6
 */

public class MinePointActivity extends BaseHtmlActicity {
    private String clientId;
    private String userId;
    private String schoolId="";
    private String classId="";

    @Override
    protected void loadData() {
        super.loadData();
        try{
            BaseRequest.VerifyInfo verifyInfo = HttpRequest.getVerifyInfo();
            if (verifyInfo != null) {
                clientId = verifyInfo.getClientId();
                userId = String.valueOf(EApplication.getInstance().getUserInfoBase().getUserId());
                if(EApplication.getInstance().getSchoolDetail()!=null){
                    schoolId=EApplication.getInstance().getSchoolDetail().getSchoolId()+"";
                }
                if(null!=EApplication.getInstance().getClazzs()&&EApplication.getInstance().getClazzs().size()>0&&null!=EApplication.getInstance().getClazzs().get(0)){
                    classId=EApplication.getInstance().getClazzs().get(0).getClassId()+"";
                }


            }
            String url = EpaperConstant.URL_H5_MINE_POINT + "clientId=" + clientId + "&userId=" + userId +
                    "&brandId=" + EApplication.BRAND_ID+"&schoolId="+schoolId+"&classId="+classId;
            setStartURL(url);
            CWLog.i("我的积分url:", url);
            loadUrl(startURL.toString());
            webView.getSettings().setTextZoom(EApplication.getInstance().gettextZoom());
            webView.getSettings().setSavePassword(false);
            setRightBtnText("积分指南", R.color.book_case_title);
            setRightBtnListener(new ViewOnClickListener() {
                @Override
                public void avertRepeatOnClick(View v) {
                    MeJumpManager.jumpToPiontRuleH5Activity(R.string.go_back, MinePointActivity.this);
                }
            });
        }catch (Exception e){
            e.getStackTrace();
        }


    }
}
